package com.aooci.ordercat.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.aooci.ordercat.enums.TakeawayStatus;

@Entity
@Table(name = "TAKEAWAY")
@NamedQuery(name="TAKEAWAY.findTakeawaysByStatus", query="SELECT t FROM Takeaway t WHERE t.status = :status")
public class Takeaway extends IdentityEntity implements Serializable {
	
	private static final long serialVersionUID = 2025637500872992548L;

	@Column(name = "TAKING_TIMESTAMP")
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar takingTimestamp;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORDERCAT_ID")
	private Ordercat ordercat;
	
	@Enumerated(EnumType.STRING)
	@Column(name = "STATUS")
	private TakeawayStatus status;
	
	@Column(name = "REMARK")
	private String remark;

	/**
	 * @return the takingTimestamp
	 */
	public Calendar getTakingTimestamp() {
		return takingTimestamp;
	}

	/**
	 * @param takingTimestamp the takingTimestamp to set
	 */
	public void setTakingTimestamp(Calendar takingTimestamp) {
		this.takingTimestamp = takingTimestamp;
	}

	/**
	 * @return the ordercat
	 */
	public Ordercat getOrdercat() {
		return ordercat;
	}

	/**
	 * @param ordercat the ordercat to set
	 */
	public void setOrdercat(Ordercat ordercat) {
		this.ordercat = ordercat;
	}
	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param remark the remark to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the status
	 */
	public TakeawayStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(TakeawayStatus status) {
		this.status = status;
	}

}
